### --- Test setup ---
if(FALSE) {
	## Not really needed, but can be handy when writing tests
	library("RUnit")
	library("unsupervisedMicroarray")
}

#data for tests
library(rda)
data(brain)
data(iris)
irDat <- as.matrix(iris[,-5])
irC <- as.numeric(iris[,5])

bx <- brain.x[,70:100]
by <- brain.y
mm<-(matrix(runif(100),ncol=5))
mmC <- c(rep(1,10),rep(2,10)) 

test.HTestRunners <-function(){
	
	kgdc <- new("KGDimChooser",1,1)
	bsdc <- new("BStickDimChooser",1,1)
	
	pcar <-new("PCAReducer",kgdc,TRUE,FALSE)
	pcar2 <-new("PCAReducer",bsdc,TRUE,FALSE)
	
	phcl <- new("HierParamClusterAlg",3)
	phcl2 <- new("HierParamClusterAlg",4)
	#list computers
	rlC <- new("ReduceClustListComputer",pcar,phcl)
	rlC2 <- new("ReduceClustListComputer",pcar2,phcl2)
	comps <-list()
	comps[[1]] <-rlC
	comps[[2]] <-rlC2	
	#score
	indO <- new("SilhIClusterScore")
	#final result
	wt <- new("WilcoxonHtester")
	pTester <- new("PHTestBFrameworkFinalResult",hTester=wt)
	#bootstraped set
	nboots <-3
	rboots <- new("RowBootstrapedSet",list(X=irDat,Y=irC),nboots)
	#sets
	setList <-list(
			One=list(X=irDat,Y=irC,Name="Iris"),
			Two=list(X=bx,Y=by,Name="Brain")
	)
	
	
	runner <-new("HTestRunner",setList=setList, compList=comps, bootstraperPrototype=rboots,
			finalResultComp=pTester, scoreObj=indO,
			resultsDirectory="./runitTresult")
	res <- runTest(runner)
	
	checkTrue(is.null(getSavedSet(pcar)))
	checkTrue(is.null(getSavedSet(pcar2)))
	
	
}


test.ChangeDimRunners <-function(){
	options(error=traceback)
	kgdc <- new("KGDimChooser",1,1)
	bsdc <- new("BStickDimChooser",1,1)
	
	pcar <-new("PCAReducer",kgdc,TRUE,FALSE)
	pcar2 <-new("PCAReducer",bsdc,TRUE,FALSE)
	
	phcl <- new("HierParamClusterAlg",3)
	phcl2 <- new("HierParamClusterAlg",4)
	#list computers
	rlC <- new("ReduceClustListComputer",pcar,phcl)
	rlC2 <- new("ReduceClustListComputer",pcar2,phcl2)
	comps <-list()
	comps[[1]] <-rlC
	comps[[2]] <-rlC2	
	#score
	indO <- new("SilhIClusterScore")
	#final result
	#wt <- new("WilcoxonHtester")
	#pTester <- new("PHTestBFrameworkFinalResult",hTester=wt)
	pTester <- new("SumBFrameworkFinalResult")
	#bootstraped set
	nboots <-3
	rboots <- new("RowBootstrapedSet",list(X=irDat,Y=irC),nboots)
	#sets
	setList <-list(
			One=list(X=irDat,Y=irC,Name="Iris"),
			Two=list(X=bx,Y=by,Name="Brain")
	)
	
	parSeq = seq(1,3,1)
	runner <-new("DimOneParamTestRunner",setList=setList, compList=comps, bootstraperPrototype=rboots,
			finalResultComp=pTester, scoreObj=indO,
			resultsDirectory="./runitTresultX",paramSeq=parSeq)
	res <- runTest(runner)
	
	
}



test.ChangeClustsRunners <-function(){
	options(error=traceback)
	kgdc <- new("KGDimChooser",1,1)
	bsdc <- new("BStickDimChooser",1,1)
	
	pcar <-new("PCAReducer",kgdc,TRUE,FALSE)
	pcar2 <-new("PCAReducer",bsdc,TRUE,FALSE)
	
	phcl <- new("HierParamClusterAlg",3)
	phcl2 <- new("HierParamClusterAlg",4)
	#list computers
	rlC <- new("ReduceClustListComputer",pcar,phcl)
	rlC2 <- new("ReduceClustListComputer",pcar2,phcl2)
	comps <-list()
	comps[[1]] <-rlC
	comps[[2]] <-rlC2	
	#score
	indO <- new("SilhIClusterScore")
	#final result
	#wt <- new("WilcoxonHtester")
	#pTester <- new("PHTestBFrameworkFinalResult",hTester=wt)
	pTester <- new("SumBFrameworkFinalResult")
	#bootstraped set
	nboots <-3
	rboots <- new("RowBootstrapedSet",list(X=irDat,Y=irC),nboots)
	#sets
	setList <-list(
			One=list(X=irDat,Y=irC,Name="Iris"),
			Two=list(X=bx,Y=by,Name="Brain")
	)
	
	parSeq = seq(1,3,1)
	runner <-new("ClustOneParamTestRunner",setList=setList, compList=comps, bootstraperPrototype=rboots,
			finalResultComp=pTester, scoreObj=indO,
			resultsDirectory="./runitTresultXX",paramSeq=parSeq)
	res <- runTest(runner)
	
	
}